package pri.ws.jersey;


import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

@Path("/helloworld")
public class RestfulHelloWorld {
    @GET
    @Path("/")
    @Produces(MediaType.TEXT_PLAIN)
    public String sayHelloWorld() {
        return "Hello World!";
    }

    @GET
    @Path("/{param}")
    @Produces("text/plain;charset=UTF-8")
    public String sayHello2UserByText(@PathParam("param") String username) {
        return "Hello " + username;
    }

    @GET
    @Path("/get")
    @Produces(MediaType.APPLICATION_JSON)
    public User sayHelloToUserByJson(@QueryParam("username") String username) {
        User user = new User();
        user.setId(1);
        user.setName(username);
        return user;
    }

}
